package com.baosight.ice.observer;

import com.alibaba.fastjson.JSONObject;
import com.zeroc.Ice.Current;
import com.zeroc.IceGrid.AdapterInfo;
import com.zeroc.IceGrid.AdapterObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;

public class AdapterObserverI implements AdapterObserver {
    public static Logger logger = LoggerFactory.getLogger(AdapterObserverI.class);
    @Override
    public void adapterInit(AdapterInfo[] adapterInfos, Current current) {
        System.out.println("adapterInit "+ Arrays.stream(adapterInfos).map(JSONObject::toJSONString));
    }

    @Override
    public void adapterAdded(AdapterInfo adapterInfo, Current current) {
        System.out.println("adapterAdded "+ adapterInfo);
    }

    @Override
    public void adapterUpdated(AdapterInfo adapterInfo, Current current) {
        System.out.println("adapterUpdated "+ adapterInfo);
    }

    @Override
    public void adapterRemoved(String s, Current current) {
        System.out.println("adapterRemoved "+ s);
    }
}
